ReplaceAll Function

Replaces all occurrences of a String with another String.

Syntax

result = ReplaceAll( sourceString, oldString, newString )

result = stringVariable.ReplaceAll( oldString, newString )


Parameters

sourceString

String

The original string.

oldString

String

The characters to be replaced.

newString

String

The replacement characters.



Notes

The ReplaceAll function replaces all occurrences of oldString in sourceString with newString. ReplaceAll is case-insensitive.

If newString is an empty string (""), the ReplaceAll function deletes every occurrence of the oldString in the sourceString.

If oldString is an empty string (""), the ReplaceAll function returns an unchanged copy of the sourceString.


Examples

Below are some examples that show the results of the ReplaceAll function

Dim result As String
result=ReplaceAll ("xyxyxy","x","z") //returns "zyzyzy"
result=ReplaceAll("The quick fox"," ","") //returns "Thequickfox"

:


See Also

Replace, ReplaceAll, ReplaceAllB, ReplaceLineEndings functions.